﻿@{
    ViewBag.Title = "CopySon";
}

@section scripts
{
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
}

<form id="form1" method="post">
            @Html.Partial("~/Views/Modular/Toolbars.cshtml")
        <div name="Base" title="商户资料" style="height:100%;overflow:hidden;margin-top:15px;margin-left:20px">
            <table style="width:100%;">
                <tr>
                    <td width="100px" height ="35px" align="right">
                       上级商户：</td>
                    <td width="200px" height ="35px">
                        @Html.Partial("~/Views/Modular/LookupCorpInfo.cshtml")
                    </td>
                </tr>
                <tr>
                    <td width="100px" height ="35px" align="right">
                       注册版本：</td>
                    <td width="200px" height ="35px">
                        <input id="comFProductID" name ="FProductID" class="mini-combobox" style="width:200px;" value ="4"
                        showNullItem="false" allowInput="false" align="left" data ="dProductID"/>   
                    </td>
                </tr>
                <tr>
                    <td width="100px" height ="35px" align="right">
                       首年激活码：</td>
                    <td width="200px" height ="35px">
                        <input id="comFActivationID" name ="FActivationID" class="mini-combobox" style="width:200px;" value ="0"
                        showNullItem="false" allowInput="false" align="left" data ="dActivation"/>   
                    </td>
                </tr>
                <tr>
                    <td width="100px" height ="35px" align="right">
                       用户初始密码：</td>
                    <td width="200px" height ="35px">
                        <input name="FPassword" id="FPassword" class="mini-textbox" style="width:200px;" value="" TabIndex="1" />
                    </td>
                </tr>
                <tr>
                    <td width="100px" height ="35px" align="right">
                       连继新增数：</td>
                    <td width="200px" height ="35px">
                        <input name="FCorpCount" class="mini-spinner" style="width: 200px;" minValue="1" maxValue="1000" 
                        changeOnMousewheel ="false" showbutton="false" value="1"/>
                    </td>
                </tr>
            </table>
            <input name="FClassID" class="mini-hidden" />
        </div>
</form>

<script>
    var dProductID = [{ "id": "1", "text": "云POS单店版" },
                     { "id": "4", "text": "连锁增强版" },
                     { "id": "5", "text": "企业电商版" },
                     { "id": "7", "text": "企业批发版" },
                     { "id": "30", "text": "单店简易版" }]

    var dActivation = [{ "id": "0", "text": "不生成" },
                     { "id": "1", "text": "自动生成" }]

    function FormShown() {
        mini.parse();
    }
    function SetInfoData(data) {
        mini.getbyName("FCorpItemID").setValue(data.FItemID);
        mini.getbyName("FCorpItemID").setText(data.FNumber);
        mini.getbyName("FCorpName").setValue(data.FName);
        mini.getbyName("FClassID").setValue(data.FClassID);
        if (data.FClassID == 1218)
        {
            mini.getbyName("FProductID").setValue(30);
        }
    }
    function SaveInfo() {
        //if (mini.getbyName("FPassword").getValue() == "") {
        //    mini.alert("用户初始密码不能为空.");
        //    return;
        //}
        //if (mini.getbyName("FCorpItemID").getValue() == "" ) {
        //    mini.alert("上级商户ID不能为空.");
        //    mini.getbyName("SaveInfo").enable();
        //    return;
        //}
        var json = "[{'FItemID':'" + mini.getbyName("FCorpItemID").getValue()
            + "','FProductID':'" + mini.getbyName("FProductID").getValue()
            + "','FActivationID':'" + mini.getbyName("FActivationID").getValue()
            + "','FClassID':'" + mini.getbyName("FClassID").getValue()
            + "','FPassword':'" + mini.getbyName("FPassword").getValue()
            + "','FCorpCount':'" + mini.getbyName("FCorpCount").getValue()
            + "'}]"
        $.post("SaveCorpSon", { mjson: json }, function (data) {
            var ret = mini.decode(data);
            if (ret.status == 1) {
                mini.showTips({ content: ret.msg, state: "success", x: "center", y: "top", timeout: 3000 });
                CloseWindow();
            }
            else {
                mini.alert("异常:" + ret.error);
            }
            mini.getbyName("SaveInfo").enable();
        });

    }
</script>